// pages/addBankCard/addBankCard.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    myCardNumber:"",
    checCardkType:'',
    bank:'',
    cardType:[
      {
        name:'储蓄卡',
        val:'savingsDepositCard',
      },
      {
        name: '信用卡',
        val: 'creditCard',
      }
    ],
    bankList:[
      {
        img:'',
        name:'中国建设银行',
        img:'151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      },
      {
        img: '',
        name: '中国建设银行',
        img: '151515'
      }
    ]
  },
  whatchNumber:function(e){
    console.log(e.detail.value)
    this.data.myCardNumber = e.detail.value
  },
  checkType:function(e){
    this.data.checCardkType = this.data.cardType[e.currentTarget.dataset.type].val
    console.log(e.currentTarget.dataset.type)
  },
  goToSureCard:function(e){
    var that = this.data
    that.bank = e.currentTarget.dataset.index
    console.log('前往01', that.myCardNumber, that.checCardkType, that.bank)
    // console.log(e.currentTarget.dataset.bank)
    if (that.myCardNumber != "" && that.checCardkType != "" ){
      console.log('前往02', that.myCardNumber, that.checCardkType, that.bank)
      let bankName = that.bankList[that.bank].name
      let cardNumber = that.myCardNumber
      let img = that.bankList[that.bank].img
      let checCardkType = that.checCardkType
      console.log('checCardkType', checCardkType)
      wx.navigateTo({
        url: '/pages/verificationBankMsg/verificationBankMsg?bankName=' + bankName + "&cardNumber=" + cardNumber + "&img=" + img + "&checCardkType=" + checCardkType,
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})